
function isOverlap(idOne,idTwo)
{ 
  var objOne=$("#"+idOne), 
  objTwo=$("#"+idTwo), 
  offsetOne=objOne.offset(), 
  offsetTwo=objTwo.offset(), 
  topOne=offsetOne.top, 
  topTwo=offsetTwo.top, 
  leftOne=offsetOne.left, 
  leftTwo=offsetTwo.left, 
  widthOne=objOne.width(), 
  widthTwo=objTwo.width(), 
  heightOne=objOne.height(), 
  heightTwo=objTwo.height(); 
  var leftTop=leftTwo>leftOne&&leftTwo<leftOne+widthOne&&
  topTwo>topOne&&topTwo<topOne+heightOne, 
  rightTop=leftTwo+widthTwo>leftOne
  &&leftTwo+widthTwo<leftOne+widthOne
  &&topTwo>topOne&&topTwo<topOne+heightOne, 
  leftBottom=leftTwo>leftOne&&leftTwo<leftOne+widthOne&& 
  topTwo+heightTwo>topOne&&topTwo+heightTwo<topOne+heightOne, 
  rightBottom=leftTwo+widthTwo>leftOne&&leftTwo+widthTwo<leftOne+widthOne&& 
  topTwo+heightTwo>topOne&&topTwo+heightTwo < topOne+heightOne; 
  return leftTop||rightTop||leftBottom||rightBottom; 
} 



$(document).ready(function () {
	// 修改头部显示
        $( "<div style='float:left;padding-top:10px;padding-left:80px;' id='pre_content'>\
        <b id='pts_brand' style='color:white;font-size:200%;margin-left:-65px'>PTS</b>\
        <span id='handel' style='margin-left:80px;'><span class='fa fa-reorder fa-2x' style='cursor:pointer'></span></span></div>" ).insertAfter( "#branding" );
     
        $('#wrap').css('transition', 'all 0.2s');
        $('.suit-columns.two-columns').css('transition', 'all 0.2s');
        $('#pts_brand').css('transition', 'all 0.2s');

        function toggle_nav(){
            if($('#suit-left').is(':visible')){
                	$('#pts_brand').css('margin-left','-130px');
                	$('#handel').css('margin-left','30px');
                    $('#suit-left').fadeOut(200);
                    $('#wrap').css('background-position-x', '-200px');
                    $('.suit-columns.two-columns').css('padding-left', '0px');
                    
            }else{
                	 $('#pts_brand').css('margin-left','-65px');
                	$('#handel').css('margin-left','80px');
                    $('#suit-left').fadeIn(200);
                    $('#wrap').css('background-position-x', '0px');
                    $('.suit-columns.two-columns').css('padding-left', '200px');
            }   
        }
       $('#handel').click(toggle_nav);

       //修改菜单左下角显示
       $('#left-nav').append('<div id="sys_info"><div id="detector"></div>\
       			<div id="inn_wrap">\
	       			<div id="feedback"><a href="http://goo.gl/forms/QCGsAsXeLe" >Feedback</a></div>\
	       			<div id="change_log"></div></div>\
       			</div>')
       $('#change_log').append($('#footer .branding'))

       	// 下面的代码，为了避免窗口太小时,sys_info，与上面的菜单重叠。
		function is_sys_info_show() {
			if(isOverlap('left-nav','detector')){
			       $('#inn_wrap').hide();
		       }else{
			       $('#inn_wrap').show();
		       }
		}
		is_sys_info_show();
       $(window).resize(function () {
	       	is_sys_info_show()
       })

       // 修改Notification的位置，
       
       //$('<a style="float:right;margin-top:13px;margin-right:20px;" href="/admin/notification/notice/" >\
       //                 <span>Notification</span>\
					  //  <span class="badge badge-default" id="unread_count"> 0 </span>\
       //             </a>').insertAfter($('#user-tools'))
})

var app = angular.module('pts',['ngAnimate']);
app.config(function($interpolateProvider) {
	  $interpolateProvider.startSymbol('[[');
	  $interpolateProvider.endSymbol(']]');
	});




